#include "trans.h"


//正式使用时，使用小火车：将buf用train.data代替，flag用train.flag代替
int sendCmd(int sockfd,char* buf,int flag){

    train_t train;
    bzero(train.data,sizeof(train.data));

    train.length  = strlen(buf);
    train.flag = flag;

    printf("sendCmd buf = %s\n",buf);
    memcpy(train.data,buf,train.length);
    train.data[train.length-1] = '\0';
    printf("train.data = %s\n",train.data);
    send(sockfd,&train,sizeof(train.length)+train.length+sizeof(train.flag),0);

    return 0;
}
